﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;


namespace TrivialPurfuit.Presentation.StartGame
{
    /// <summary>
    /// Interaction logic for StartGameView.xaml
    /// </summary>
    public partial class StartGameView : Window
    {
        enum ClosingState { KillGame, StartGame };

        private ClosingState closingState;

        private StartGameView()
        {
            InitializeComponent();

            // this is set so that if the red "X" is pressed it kills the game.
            closingState = ClosingState.KillGame;
        }

        public static void ShowDialogNow()
        {
            StartGameView temp = new StartGameView();
            temp.ShowDialog();
        }



        private void EditQuestions_Click(object sender, RoutedEventArgs e)
        {
            Presentation.Edit.EditQuestionsView editQuestionsView = new Edit.EditQuestionsView();
            editQuestionsView.ShowDialog();

            TrivialPurfuit.Business.GameBoard.Instance.Category1.RaisePropertyChanged("");
            TrivialPurfuit.Business.GameBoard.Instance.Category2.RaisePropertyChanged("");
            TrivialPurfuit.Business.GameBoard.Instance.Category3.RaisePropertyChanged("");
            TrivialPurfuit.Business.GameBoard.Instance.Category4.RaisePropertyChanged("");
        }

        private void about_Click(Object sender, RoutedEventArgs args)
        {
            Presentation.About.AboutBox1.ShowNow();
        }

        private void gameHelp_Click(Object sender, RoutedEventArgs args)
        {
            Presentation.Help.Window2.ShowNow();
        }



        private void Exit_Click(object sender, RoutedEventArgs e)
        {
            closingState = ClosingState.KillGame;
            this.Close();
        }

        private void StartGame_Click(object sender, RoutedEventArgs e)
        {
            closingState = ClosingState.StartGame;
            this.Close();
        }

        private void Window_Closed(object sender, EventArgs e)
        {
            if (closingState == ClosingState.KillGame && Application.Current.MainWindow != null)
                Application.Current.MainWindow.Close();
        }

    }
}
